// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SA1643DestructorSummaryDocumentationMustBeginWithStandardTextBulbItem.cs" company="StyleCop for ReSharper Development Team">
//   Copyright (c) StyleCop for ReSharper Development Team. All rights reserved.
// </copyright>
// <summary>
//   Defines the SA1643DestructorSummaryDocumentationMustBeginWithStandardTextBulbItem type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace StyleCop.For.ReSharper.BulbItems.Documentation
{
    #region Using Directives

    using JetBrains.ProjectModel;
    using JetBrains.ReSharper.Psi.CSharp.Tree;
    using JetBrains.TextControl;

    using StyleCop.For.ReSharper.BulbItems.Framework;
    using StyleCop.For.ReSharper.CodeCleanup.Rules;
    using StyleCop.For.ReSharper.Core;

    #endregion

    /// <summary>
    /// SA1642: SA1643DestructorSummaryDocumentationMustBeginWithStandardTextBulbItem.
    /// </summary>
    public class SA1643DestructorSummaryDocumentationMustBeginWithStandardTextBulbItem : V5BulbItemImpl
    {
        public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl)
        {
            var element = Utils.GetElementAtCaret(solution, textControl);

            if (element != null)
            {
                var destructorDeclaration = element.GetContainingElement<IDestructorDeclaration>(true);
                if (destructorDeclaration != null)
                {
                    new DocumentationRules().EnsureDestructorSummaryDocBeginsWithStandardText(destructorDeclaration);
                }
            }
        }
    }
}